package com.xiaocc.spring.demo.action;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("hello")
public class HelloAction {

	@RequestMapping(method = RequestMethod.GET)
	@ResponseBody
	public String hellAction() {
		return "hello";
	}

	
	public static void main(String[] args) {
		int [] a = {3,4,5,3,2};
		quicksort(a, 0, a.length-1);
	}
	
	
	private static void quicksort(int[] temp, int left, int right) {

		if (left < right) {
			int key = temp[left];
			int low = left;
			int high = right;

			while (low < high) {

				while (low < high && temp[high] >= key) {
					high--;
				}
				temp[low] = temp[high];

				while (low < high && temp[low] <= key) {
					low++;
				}
				temp[high] = temp[low];

			}
			temp[low] = key;
			System.out.println();
			System.out.println("<-------------------------->");
			for (int a : temp) {
				System.out.printf("%5d", a);
			}
			System.out.println();
			quicksort(temp, left, low - 1);
			quicksort(temp, low + 1, right);
		}
	}
}
